/**********************************************************************************
// DemoFont
// 
// Creation:	28 Apr 2011
// Updated:		27 May 2011
// Compiler:	Visual Studio 2010
//
// Notes:		Test the font class draw capabilities
//
**********************************************************************************/

#define WIN32_LEAN_AND_MEAN  // just say no to MFC

#include "Resources.h"
#include "Anabele.h"	

/**********************************************************************************/
/*                          FontDemo Class                                        */
/**********************************************************************************/


class FontDemo: public D3DGame
{
private:
	Font * arial;
	Font * lucida;
	Font * times;
	Font * tahoma;
	Font * verdana;
	Font * sansserif;
	Font * courier;

public:
	void GameInit();
	void GameLogic();
	void GameDraw();
	void GameShutDown();
};

/**********************************************************************************/

void FontDemo::GameInit()
{
	arial = new Font("Arial", 36);
	lucida = new Font("Lucida Console", 36);
	times = new Font("Times New Roman", 36);	
	tahoma = new Font("Tahoma", 36);
	verdana = new Font("Verdana", 36);
	sansserif = new Font("MS Sans Serif", 36);
	courier = new Font("Courier New", 36);
}

/**********************************************************************************/

void FontDemo::GameShutDown()
{
	if (arial) delete arial;
	if (lucida) delete lucida;
	if (times) delete times;
	if (tahoma) delete tahoma;
	if (verdana) delete verdana;
	if (sansserif) delete sansserif;
	if (courier) delete  courier;
}

/**********************************************************************************/

void FontDemo::GameLogic()
{
	// for now test if user is hitting ESC and quit game
	EndsOnEscape();
	
} 

/**********************************************************************************/

void FontDemo::GameDraw()
{
	arial->Draw(60, 50, "Arial 36 font printed with ID3DXFont");
	lucida->Draw(60, 150, "Lucida 36 font printed with ID3DXFont", Color(0,192,192));
	times->Draw(60, 250, "Times New Roman 36 font printed with ID3DXFont", Color(255,255,0));
	tahoma->Draw(60, 350, "Tahoma 36 font printed with ID3DXFont", Color(255,0,255)); 	
	verdana->Draw(60, 450, "Verdana 36 font printed with ID3DXFont",Color(0,0,255));
	sansserif->Draw(60, 550, "MS Sans Serif 36 font printed with ID3DXFont", Color(255,0,0));
	courier->Draw(60, 650, "Courrier New 36 font printed with ID3DXFont", Color(120,0,120));
}

/**********************************************************************************/
/*                                  WinMain                                       */
/**********************************************************************************/

int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
	FontDemo fontDemo;

	fontDemo.SetWindowMode(WINDOWED);
	fontDemo.SetWindowSize(1024,768);	
	fontDemo.SetWindowBgColor(16,16,16);
	fontDemo.SetWindowTitle(string("Font Demo"));
	fontDemo.SetWindowIcon(LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON)));
	fontDemo.SetWindowCursor(LoadCursor(hInstance, MAKEINTRESOURCE(IDI_CURSOR)));
	fontDemo.ShowWindowCursor(true);
	fontDemo.Initialize(hInstance);
	fontDemo.Start();
	
	return 0;
}

/**********************************************************************************/

